i cannot tell you how many times I see guys who try and 'hit their macros' and finish the day off with pizza and mcdonalds exactly what you said.
your post is why 'counting macros' is the biggest bullshit ever invented in the past 20 years. I do not see a single animal in the wild who counts their macros and never in human history have we counted macros. in fact the ONLY animals which get their macros counted are those in captivity, which ironically suffer from mental issues and depression.
STOP counting macros, delete those stupid apps, stop trying to reinvent the wheel. the same people that started the count your macros scam are the same ones who charge hundreds for copy/paste diet programs which fail miserably.
i'm not sure what idiot put you on that program, but if you continue doing it you will end up FAT, very FAT. you aren't putting on muscle that way sorry. muscle mass is put on via weight and resistance training over the course of many many years. it isn't put on by eating lots of calories