You must add everything to the build priority, if you place a building on the map already that is not on the building list, the AI will bug.
Basically, add everything you want in the AI to the build priority. Then you can choose: either place the building or unit you want on the map, or don't and let the AI build it. Of course, you need to place the main building of the race on the map so that it can create workers which then make the other buildings. But it is your choice if you want the other buildings pre-placed on map, or not (so AI builds them).
In my opinion it is best to pre-place buildings, so you have an initial layout for the AI base. It is also a good idea to preplace multiple units near the outside of your base where enemy's will attack, if that AI will fight other AI. This is because enemy AI often targets the nearest building/structure to their own base, and if you have 1 single building (like a tower) on the outside of your base, enemy AI will often attack it then retreat. This is why if you have multiple preplaced units there, it will keep the enemy AI busy long enough for your non-preplaced units to come, since non-preplaced units (ones that AI builds) will automatically stay around the goldmine/main building, unless it attacks of defends.
Even if you preplace on map, you need to include it in the build order.
If you dont like having too many farms, edit the food provided by a farm, so each one gives 50 food or something. But if you edit object data, then you will need to re-import the object data from your map, which will automatically delete the AI you have on the AI editor.
Custom AI hero must be preplaced on map, since the AI will be unable to "build it". It can only revive it, so the for the first time it must be on the map already (preplaced). But you still need to include it on the build order, even if it is preplaced. That way, the AI will automatically re-summon the hero. If you want it to defend the base, just place the hero near where the base will be attacked.
I strongly recommend you look at some of the AI in campaigns, or play around making your own, as it will help understand the AI editor better. Good luck.